﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Baimasoft.Manage.SqlServerDAL;

public partial class SysManage_Role_Index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Indicator.Text = Request.QueryString["sIndicator"].ToString();
        }
        catch
        {
        }
        #region   //功能角色管理//

        string ThisPageID = "";
        try
        {
            ThisPageID = Session[SessionConst.PageID].ToString().Trim();
        }
        catch
        {
            ThisPageID = "";
        }

        string sRoleCode = "";
        try
        {
            sRoleCode = Session["Baimasoft_Role_Code"].ToString().Trim();
        }
        catch
        {
            sRoleCode = "";
        }
        if (sRoleCode.Trim() != "" && sRoleCode.Trim() != "0")
        {
            string[] aAllChoiceBtn = RightDAL .GetPageOfBtnInfo(sRoleCode, ThisPageID);                          //拆分按钮

            //所有已注册的页面按钮设置为不可见
            string[] aAllBtnID = aAllChoiceBtn[0].Split('^');                   //当前页面上所有按钮的集合
            int iAllBtnID = aAllBtnID.Length;
            for (int i = 0; i < iAllBtnID - 1; i++)
            {
                string sBtnID = "btn_" + aAllBtnID[i];    //组合页面按钮
                try
                {
                    System.Web.UI.HtmlControls.HtmlInputButton sbtn = (System.Web.UI.HtmlControls.HtmlInputButton)(FindControl(sBtnID));   //查找页面按钮
                    sbtn.Visible = false;
                }
                catch
                {
                }
            }

            //已授权的按钮设置为可见



            string[] aChoiceBtnID = aAllChoiceBtn[1].Split('^');                   //已授权按钮的集合
            int iChoiceBtnID = aChoiceBtnID.Length;
            for (int i = 0; i < iChoiceBtnID - 1; i++)
            {
                string sBtnID = "btn_" + aChoiceBtnID[i];    //组合页面按钮
                try
                {
                    System.Web.UI.HtmlControls.HtmlInputButton sbtn = (System.Web.UI.HtmlControls.HtmlInputButton)(FindControl(sBtnID));   //查找页面按钮
                    sbtn.Visible = true;
                }
                catch
                {
                }
            }
        }

        #endregion
    }
   
}
